package com.itheima.pattern02.decorator07;


/**
 * @version v1.0
 * @ClassName: Client
 * @Description: TODO(一句话描述该类的功能)
 * @Author: 黑马程序员
 */
public class Client {
    public static void main(String[] args) {

        abstract class A{
            Integer c=1;
            int  getC(){
                return c;
            }
        }
        class B extends A{
            Integer c=2;
            int  getC(){
                return c;
            }
        }
        A a=new B();
        System.out.println(a.c);
        System.out.println(a.getC());
        System.out.println("上面是单纯的自己测试抽象类，与设计模式无关");
        //点一份炒饭
        FastFood food = new FriedRice();
        System.out.println(food.cost());
        System.out.println(food.getDesc() + "  " + food.cost() + "元");

        System.out.println("===============");

        //在上面的炒饭中加一个鸡蛋
        food = new Egg(food);
        System.out.println(food.getDesc() + "  " + food.cost() + "元");

        System.out.println("================");
        //再加一个鸡蛋
        food = new Egg(food);
        System.out.println(food.getDesc() + "  " + food.cost() + "元");

        System.out.println("================");
        food = new Bacon(food);
        System.out.println(food.getDesc() + "  " + food.cost() + "元");
    }
}
